#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
using webapp4U.DAL;
#endregion


namespace webapp4U.BOL
{
	 public class Companies : BizObject
	 {
         #region Member Variables

         private Int32 _companyID;

         private String _companyName;

         private String _address;

         private String _email;

         private String _phone;

         private String _mobile;

         private String _fax;

         private DateTime _addedDate;

         private String _addedBy;

         private Int32 _displayOrder;

         private Boolean _isActive;

         private String _description;

         private String _logo;

         #endregion



         #region Public Properties

         public Int32 CompanyID
         {
             get { return _companyID; }
             set { _companyID = value; }
         }

         public String CompanyName
         {
             get { return _companyName; }
             set { _companyName = value; }
         }

         public String Address
         {
             get { return _address; }
             set { _address = value; }
         }

         public String Email
         {
             get { return _email; }
             set { _email = value; }
         }

         public String Phone
         {
             get { return _phone; }
             set { _phone = value; }
         }

         public String Mobile
         {
             get { return _mobile; }
             set { _mobile = value; }
         }

         public String Fax
         {
             get { return _fax; }
             set { _fax = value; }
         }

         public DateTime AddedDate
         {
             get { return _addedDate; }
             set { _addedDate = value; }
         }

         public String AddedBy
         {
             get { return _addedBy; }
             set { _addedBy = value; }
         }

         public Int32 DisplayOrder
         {
             get { return _displayOrder; }
             set { _displayOrder = value; }
         }

         public Boolean IsActive
         {
             get { return _isActive; }
             set { _isActive = value; }
         }

         public String Description
         {
             get { return _description; }
             set { _description = value; }
         }

         public String Logo
         {
             get { return _logo; }
             set { _logo = value; }
         }

         #endregion


	     #region public static Methods


         public static string GetCompanyName(int CompanyID)
         {
             try
             {
                 Companies obj = GetCompaniesByID(CompanyID);
                 return obj.CompanyName;
             }
             catch
             { return ""; }
         }

         public static string GetLogo(int CompanyID)
         {
             try
             {
                 Companies obj = GetCompaniesByID(CompanyID);
                 return obj.Logo;
             }
             catch
             { return ""; }
         }


	     public static int Insert(Companies obj)
	     {
		     CompaniesDAL db = new CompaniesDAL();
		     return db.Insert(obj);
	     }

	     public static bool Update(Companies obj)
	     {
		     CompaniesDAL db = new CompaniesDAL();
		     return db.Update(obj);
	     }

	     public static bool Delete(Int32 CompanyID)
	     {
		     CompaniesDAL db = new CompaniesDAL();
		     return db.Delete(CompanyID); 
	     }

	     public static Companies GetCompaniesByID(Int32 CompanyID)
	     {
		     CompaniesDAL db = new CompaniesDAL();
		     return db.GetCompaniesByID(CompanyID);
	     }

         //Get All Companies
         public static List<Companies> GetAllCompanies()
         {
             CompaniesDAL db = new CompaniesDAL();
             return db.GetAllCompanies(1, 1000);
         }

	     //Get All Companies
	     public static List<Companies> GetAllCompanies(int PageIndex, int PageSize)
	     {
		     CompaniesDAL db = new CompaniesDAL();
		     return db.GetAllCompanies(PageIndex, PageSize);
	     }

	     // Get Count All records of Table  Companies
	     public static int GetCountCompanies()
	     {
		     CompaniesDAL db = new CompaniesDAL();
		     return db.GetCountCompanies();
	     }



	     #endregion
	 }
}
